package analiseSemantica;

public class Semantica {

    public class Program {
        Decls declsref;  //referencia para Decls


         public Program(Object ob) {

              if ( ob instanceof Decls )
                  this.declsref = (Decls) ob;

         }

        public Decls getDeclsref() {
            return declsref;
        }

        public void setDeclsref(Decls declsref) {
            this.declsref = declsref;
        }

    }



    public class Decls {
           VarDecl varDeclLisRef = null;       //ira apontar para umas lista de varDecl
           FuncDecl funcDeclRef = null;       // ira apontar para uma lista de funcDeclRef
           Decls declsRef = null;
           int type;
           String id;
           int cat;


     public Decls(int type , String id , int cat, Object ob , Object ob2) {
            this.type = type;
            this.id  = id;
            this.cat = cat;


            if ( ob instanceof VarDecl)
             this.varDeclLisRef = (VarDecl) ob;

            if ( ob instanceof FuncDecl )
                  this.funcDeclRef = (FuncDecl) ob;

            if ( ob2 instanceof Decls )
                  this.declsRef = (Decls) ob2;


      }



          public Decls(int type , String id , int cat, Object ob) {
            this.type = type;
            this.id  = id;
            this.cat = cat;
              if ( ob instanceof FuncDecl )
                  this.funcDeclRef = (FuncDecl) ob;

         }

        public Decls getDeclsRef() {
            return declsRef;
        }

        public void setDeclsRef(Decls declsRef) {
            this.declsRef = declsRef;
        }

        public FuncDecl getFuncDeclRef() {
            return funcDeclRef;
        }

        public void setFuncDeclRef(FuncDecl funcDeclRef) {
            this.funcDeclRef = funcDeclRef;
        }

        public VarDecl getVarDeclLisRef() {
            return varDeclLisRef;
        }

        public void setVarDeclLisRef(VarDecl varDeclLisRef) {
            this.varDeclLisRef = varDeclLisRef;
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }



    }




    public class Type {
        String cat;

        public String getCat() {
            return cat;
        }

        public void setCat(String cat) {
            this.cat = cat;
        }


    }


    public class FuncDecl {

        ParamDeclList paramDeclListRef = null;
        Block blockRef =  null;

         public FuncDecl(Object ob , Object ob2) {

            if ( ob instanceof ParamDeclList)
             this.paramDeclListRef = (ParamDeclList) ob;

            if ( ob2 instanceof Block )
                  this.blockRef = (Block ) ob2;

         }

        public Block getBlockRef() {
            return blockRef;
        }

        public void setBlockRef(Block blockRef) {
            this.blockRef = blockRef;
        }

        public ParamDeclList getParamDeclListRef() {
            return paramDeclListRef;
        }

        public void setParamDeclListRef(ParamDeclList paramDeclListRef) {
            this.paramDeclListRef = paramDeclListRef;
        }




    }




    public class VarDecl {
       int cat;
       String constante;
        VarDecl varDeclRef = null; //feito para fazer as listas

        public VarDecl(int cat) {
            this.cat = cat;
        }




        public VarDecl(String constante , int cat , Object ob) {
            this.constante = constante;
            this.cat = cat;
            
            if ( ob instanceof VarDecl)
             this.varDeclRef = (VarDecl) ob;

         }


        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public VarDecl getVarDeclRef() {
            return varDeclRef;
        }

        public void setVarDeclRef(VarDecl varDeclRef) {
            this.varDeclRef = varDeclRef;
        }

        public String getConstante() {
            return constante;
        }

        public void setConstante(String constante) {
            this.constante = constante;
        }




    }




public class ParamDeclList {
    ParamDeclListTail paramDeclListTailRef = null;

        public ParamDeclList() {
            this.paramDeclListTailRef = null;
        }
        public ParamDeclList(Object ob) {

            if ( ob instanceof ParamDeclListTail)
             this.paramDeclListTailRef = (ParamDeclListTail) ob;

         }


        public ParamDeclListTail getParamDeclListRef() {
            return paramDeclListTailRef;
        }

        public void setParamDeclListRef(ParamDeclListTail paramDeclListRef) {
            this.paramDeclListTailRef = paramDeclListRef;
        }
    
        
    
    
}


public class ParamDeclListTail {
         ParamDecl paramDeclRef = null; //apenas um a referencia proxima será null
        ParamDeclListTail paramDeclListTailRef = null;

        public ParamDeclListTail(Object ob) {

            if ( ob instanceof ParamDecl)
             this.paramDeclRef = (ParamDecl) ob;

         }
         public ParamDeclListTail(Object ob , Object ob2) {

            if ( ob instanceof ParamDeclListTail)
             this.paramDeclListTailRef = (ParamDeclListTail) ob;

            if ( ob2 instanceof ParamDecl )
                  this.paramDeclRef = (ParamDecl ) ob2;

         }

        public ParamDeclListTail getParamDeclListTailRef() {
            return paramDeclListTailRef;
        }

        public void setParamDeclListTailRef(ParamDeclListTail paramDeclListTailRef) {
            this.paramDeclListTailRef = paramDeclListTailRef;
        }

        public ParamDecl getParamDeclRef() {
            return paramDeclRef;
        }

        public void setParamDeclRef(ParamDecl paramDeclRef) {
            this.paramDeclRef = paramDeclRef;
        }
    
    
    
}


public class ParamDecl {
        int type;
        int cat;
        String id;

        public ParamDecl(int type, String id, int cat) {
            this.type = type;
            this.id = id;
            this.cat = cat;
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }



    
    
}


    public class VarDeclList {
        VarDecl varDeclRef;
        VarDeclList varDeclListRef;
        int cat;
        int type;
        String id;

        public VarDeclList(int cat) {
            this.cat = cat;
            this.varDeclListRef = null;
            this.varDeclRef = null;
        }

         public VarDeclList(int type , String id, int cat , Object ob , Object ob2) {
            this.type = type;
            this.id = id;
            this.cat = cat;

            if ( ob instanceof VarDecl)
             this.varDeclRef = (VarDecl) ob;

            if ( ob2 instanceof VarDeclList)
                  this.varDeclListRef = (VarDeclList) ob2;

         }

        public VarDeclList getVarDeclListRef() {
            return varDeclListRef;
        }

        public void setVarDeclListRef(VarDeclList varDeclListRef) {
            this.varDeclListRef = varDeclListRef;
        }

        public VarDecl getVarDeclRef() {
            return varDeclRef;
        }

        public void setVarDeclRef(VarDecl varDeclRef) {
            this.varDeclRef = varDeclRef;
        }



        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public int getType() {
            return type;
        }

        public void setType(int type) {
            this.type = type;
        }
        






    }




    public class Block {
        VarDeclList varDeclListRef = null;
        StmtList stmtListRef = null;

          public Block(Object ob ) {
            if (ob instanceof VarDeclList)
            this.varDeclListRef = (VarDeclList) ob;

        }

        public Block(Object ob , Object ob2) {
            if (ob instanceof VarDeclList)
            this.varDeclListRef = (VarDeclList) ob;

            if( ob2 instanceof StmtList)
            this.stmtListRef = (StmtList) ob2;
        }



        public StmtList getStmtListRef() {
            return stmtListRef;
        }

        public void setStmtListRef(StmtList stmtListRef) {
            this.stmtListRef = stmtListRef;
        }

        public VarDeclList getVarDeclListRef() {
            return varDeclListRef;
        }

        public void setVarDeclListRef(VarDeclList varDeclListRef) {
            this.varDeclListRef = varDeclListRef;
        }




    }







    public class StmtList {
        Stmt stmtRef = null;
        StmtList stmtListRef = null;

        public StmtList(Object ob) {
            if( ob instanceof Stmt)
            this.stmtRef = (Stmt) ob;
            
        }

   public StmtList(Object ob , Object ob2) {
          if( ob instanceof Stmt)
            this.stmtRef = (Stmt) ob;

           if( ob instanceof StmtList)
            this.stmtListRef = (StmtList) ob2;

        }



        public StmtList getStmtListRef() {
            return stmtListRef;
        }

        public void setStmtListRef(StmtList stmtListRef) {
            this.stmtListRef = stmtListRef;
        }

        public Stmt getStmtRef() {
            return stmtRef;
        }

        public void setStmtRef(Stmt stmtRef) {
            this.stmtRef = stmtRef;
        }




    }



    public class Stmt {

        Expr exprRef = null;
        Stmt stmtRef = null;
        Stmt stmtRef2 = null;
        Block blockRef = null;
        int cat;
        String id;
        String str;

        public Stmt(int cat) {
            this.cat = cat;
        }

        public Stmt(String st, int cat) {
            this.cat = cat;
            if( cat == 5)
                this.id = id;
            if( cat == 7)
                this.str = st;
        }


        public Stmt(int cat , Object ob) {
            this.cat = cat;

            if( ob instanceof Expr)
                this.exprRef = (Expr) ob;

            if( ob instanceof Block)
                this.blockRef = (Block) ob;

        }


        public Stmt(int cat , Object ob , Object ob2) {
            this.cat = cat;

            if( ob instanceof Expr)
                this.exprRef = (Expr) ob;

            if( ob instanceof Stmt)
                this.stmtRef = (Stmt) ob2;

        }

        public Stmt(int cat , Object ob , Object ob2 , Object ob3) {
            this.cat = cat;

            if( ob instanceof Expr)
                this.exprRef = (Expr) ob;

            if( ob instanceof Stmt)
                this.stmtRef = (Stmt) ob2;

            if( ob instanceof Stmt)
                this.stmtRef2 = (Stmt) ob3;

        }

        public Block getBlockRef() {
            return blockRef;
        }

        public void setBlockRef(Block blockRef) {
            this.blockRef = blockRef;
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public Expr getExprRef() {
            return exprRef;
        }

        public void setExprRef(Expr exprRef) {
            this.exprRef = exprRef;
        }

        public Stmt getStmtRef() {
            return stmtRef;
        }

        public void setStmtRef(Stmt stmtRef) {
            this.stmtRef = stmtRef;
        }

        public Stmt getStmtRef2() {
            return stmtRef2;
        }

        public void setStmtRef2(Stmt stmtRef2) {
            this.stmtRef2 = stmtRef2;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getStr() {
            return str;
        }

        public void setStr(String str) {
            this.str = str;
        }







    }



    public class Expr {

        Expr exprRef = null;               //Gera a lista em PostExprFix e UnaryExpr
        UnaryExpr unaryExprRef = null;     //aponta para o primeiro de UnaryExpr
        BinaryExpr binaryExprRef = null ;   //aponta para o primeiro de BinaryExpr

        public Expr(Object ob) {
            if( ob instanceof BinaryExpr)
            this.binaryExprRef = (BinaryExpr) ob;
        }

          public Expr(Object ob , Object ob2 ) {
             if(ob instanceof UnaryExpr )
            this.unaryExprRef = (UnaryExpr ) ob;
            if(ob2 instanceof Expr )
             this.exprRef = (Expr ) ob2;
        }


        public BinaryExpr getBinaryExprRef() {
            return binaryExprRef;
        }

        public void setBinaryExprRef(BinaryExpr binaryExprRef) {
            this.binaryExprRef = binaryExprRef;
        }

        public Expr getExprRef() {
            return exprRef;
        }

        public void setExprRef(Expr exprRef) {
            this.exprRef = exprRef;
        }

        public UnaryExpr getUnaryExprRef() {
            return unaryExprRef;
        }

        public void setUnaryExprRef(UnaryExpr unaryExprRef) {
            this.unaryExprRef = unaryExprRef;
        }

        
        


    }

    public class PostFixExpr {

        Expr exprRef = null;
        ArgumentList argumentLisRef = null;
        int cat;
        String id;
       Constant constante;

     public PostFixExpr(int cat) {
               this.cat = cat;
     }
   
     public PostFixExpr(Object ob , int cat) {
              this.cat = cat;
              this.constante = (Constant) ob;
              
     }
     
     
          public PostFixExpr(String id , int cat) {
              this.cat = cat;
              this.id = id;
              
     }
     
     
        public PostFixExpr(String id ,int cat, Object ob) {
            this.id = id;   
            this.cat = cat;

            if( ob instanceof ArgumentList )
                 this.argumentLisRef = (ArgumentList) ob;

             if( ob instanceof Expr )
                 this.exprRef = (Expr) ob;
            
        }

        public ArgumentList getArgumentLisRef() {
            return argumentLisRef;
        }

        public void setArgumentLisRef(ArgumentList argumentLisRef) {
            this.argumentLisRef = argumentLisRef;
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public Constant getConstante() {
            return constante;
        }

        public void setConstante(Constant constante) {
            this.constante = constante;
        }

        public Expr getExprRef() {
            return exprRef;
        }

        public void setExprRef(Expr exprRef) {
            this.exprRef = exprRef;
        }

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }





    }
    
    

    public class ArgumentList {
        ArgumentList argumentListRef = null;
        Expr exprRef = null;

        public ArgumentList(Object ob) {
            if ( ob instanceof Expr)
                    this.exprRef = (Expr) ob;
            
        }

        public ArgumentList(Object ob , Object ob2) {
            if ( ob instanceof Expr)
                    this.exprRef = (Expr) ob;

            if ( ob instanceof ArgumentList)
                    this.argumentListRef = (ArgumentList) ob;

        }


        public Expr getExprRef() {
            return exprRef;
        }

        public void setExprRef(Expr exprRef) {
            this.exprRef = exprRef;
        }

        public ArgumentList getArgumentListRef() {
            return argumentListRef;
        }

        public void setArgumentListRef(ArgumentList argumentListRef) {
            this.argumentListRef = argumentListRef;
        }



      
    }
    
    
    public class BinaryExpr {
        BinaryExpr binaryExprRef = null;
        UnaryExpr unaryExprRef = null;
        Binop binopRef = null;   // agrupa a segunda regra de binaryExpr

        public BinaryExpr(Object ob) {
            if (ob instanceof UnaryExpr)
            this.unaryExprRef = (UnaryExpr) ob ;
        }


        public BinaryExpr( Object ob ,   Object ob2 ,   Object ob3) {
            
           
            if ( ob instanceof BinaryExpr)
            this.binaryExprRef = (BinaryExpr)ob;
        
            if(ob2 instanceof Binop)
                 this.binopRef = (Binop) ob2;
            
            
            if(ob3 instanceof UnaryExpr)
                this.unaryExprRef = (UnaryExpr) ob3 ;
        }



        public BinaryExpr getBinaryExprRef() {
            return binaryExprRef;
        }

        public void setBinaryExprRef(BinaryExpr binaryExprRef) {
            this.binaryExprRef = binaryExprRef;
        }

        public Binop getBinopRef() {
            return binopRef;
        }

        public void setBinopRef(Binop binopRef) {
            this.binopRef = binopRef;
        }

        public UnaryExpr getUnaryExprRef() {
            return unaryExprRef;
        }

        public void setUnaryExprRef(UnaryExpr unaryExprRef) {
            this.unaryExprRef = unaryExprRef;
        }



    }

    
    
public class Constant {
    int cat;
    String constante;

        public Constant( String constante , int cat) {
            this.constante = constante;
            this.cat = cat;
            
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

        public String getConstante() {
            return constante;
        }

        public void setConstante(String constante) {
            this.constante = constante;
        }





}


    public class UnaryOp {

        int cat;                         //recebe o terminal

        public UnaryOp(int cat) {
            this.cat = cat;

        }


        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }

  }
    
    
    

    public class UnaryExpr {

      
        UnaryExpr unaryExprRef = null;         // ou para UnaryExpr para Expr e gerar a lista
        UnaryOp unaryOpRef = null ;             // ou para Lista de UnaryOp
        PostFixExpr postFixExprRef = null;     // ou para PostFixExpr

        public UnaryExpr(Object ob) {
            if( ob instanceof PostFixExpr )
            this.postFixExprRef = (PostFixExpr) ob;
        }

        public UnaryExpr(Object ob , Object ob2) {
            if( ob instanceof UnaryOp)
            this.unaryOpRef = (UnaryOp) ob;

            if( ob instanceof UnaryExpr)
            this.unaryExprRef = (UnaryExpr) ob2;
        }

        public PostFixExpr getPostFixExprRef() {
            return postFixExprRef;
        }

        public void setPostFixExprRef(PostFixExpr postFixExprRef) {
            this.postFixExprRef = postFixExprRef;
        }

        public UnaryExpr getUnaryExprRef() {
            return unaryExprRef;
        }

        public void setUnaryExprRef(UnaryExpr unaryExprRef) {
            this.unaryExprRef = unaryExprRef;
        }

        public UnaryOp getUnaryOpRef() {
            return unaryOpRef;
        }

        public void setUnaryOpRef(UnaryOp unaryOpRef) {
            this.unaryOpRef = unaryOpRef;
        }
        
        
   






    }

    public class Binop {

    
        BooleanOp booleanopRef = null;
        RelOp realOpRef = null;
        AritmOp aritmOpRef = null;

        public Binop(Object ob) {

         if( ob instanceof BooleanOp)
             this.booleanopRef = (BooleanOp) ob;

          if( ob instanceof RelOp)
             this.realOpRef = (RelOp) ob;

          if( ob instanceof AritmOp)
             this.aritmOpRef = (AritmOp) ob;
         
        }





        public AritmOp getAritmOpRef() {
            return aritmOpRef;
        }

        public void setAritmOpRef(AritmOp aritmOpRef) {
            this.aritmOpRef = aritmOpRef;
        }

        public BooleanOp getBooleanopRef() {
            return booleanopRef;
        }

        public void setBooleanopRef(BooleanOp booleanopRef) {
            this.booleanopRef = booleanopRef;
        }

        public RelOp getRealOpRef() {
            return realOpRef;
        }

        public void setRealOpRef(RelOp realOpRef) {
            this.realOpRef = realOpRef;
        }


    }

    public class BooleanOp {

        int cat;  // tipo do operador

        BooleanOp(int cat) {
            this.cat = cat;
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }



    }

    public class RelOp {

        int cat;  // tipo do operador

        RelOp(int cat) {
            this.cat = cat;
        }

        public int getCat() {
            return cat;
        }

        public void setCat(int cat) {
            this.cat = cat;
        }




    }

    public class AritmOp {

        int cat;  // tipo do operador

        AritmOp(int cat) {
            this.cat = cat;
        }

        public int getCat() {
            return cat;
        }



        public void setCat(int cat) {
            this.cat = cat;
        }

    }
    
    
}



